package com.xixiake.activity;

import android.app.Activity;
import android.os.Bundle;
import android.os.PersistableBundle;

import com.xixiake.R;
import com.xixiake.immersive.ImmersiveUtil;
import com.xixiake.immersive.SystemBarCompact;

/**
 * Created by c-wanghengli on 2017/4/3.
 */
public class BaseActivity extends Activity {

    public boolean needStatusTran = true; //设置状态栏颜色为透明
    public boolean needImmerSive = true; //设置状态栏颜色

    public SystemBarCompact mSystemBarCompact;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setImmersiveStatus();
    }

    private void setImmersiveStatus() {
        if(needStatusTran && ImmersiveUtil.isSupportImmersive() ==1){
            getWindow().addFlags(0x04000000);
            if(needImmerSive){
               int color = getResources().getColor(R.color.CL_APP_MAIN);
                mSystemBarCompact = new SystemBarCompact(this,true,color);
            }
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        if(mSystemBarCompact != null){
            mSystemBarCompact.init();
        }
    }
}
